const {baseController} = require('../../baseController')
const serviceEnter = require('../../../service/serviceEnter')
const model = require('../../../dao/model/model')
const beansEnter = require('../../../beans/beansEnter')
const result = require('../../../util/result/result')


class kemuController extends  baseController{

    static sigleIns = new kemuController()

    static getSigleIns =()=>{
        if(this.sigleIns){
            return this.sigleIns
        }else{
            return new kemuController()
        }
    }

    constructor(){
        super(serviceEnter.kemuService.getIns())
    }

    async findPointByKemuId(req,res){
        let data  
        let obj={}
        obj.kemuid=req.body.kemuid
        try {
            data =  await new serviceEnter.tittlePointService(model.modelpoint,beansEnter.tittlePointBean).findByObj(obj)
        } catch (error) {
            // res.send(result.result(false,error))
            console.log(error);
        }


        if(data==undefined){
            res.send(result.result(false))
        }else{
            res.send(result.result(true,data))
        }
    }

    async queryAll (req,res){
        let data  
        try {
            data =  await  this.service.queryAll('xueke_id')
        } catch (error) {
                console.log(error)
            return 
        }



        if(data&&data!=undefined){
            res.send(result.result(true,data))
         }else{
            res.send(result.result(false))
         }


    }

}

module.exports={
    kemuController
}